//http://api.douban.com/v2/movie/subject/1764796

const rp = require('request-promise-native')

async function fetchMovie(item) {
    const url = `http://api.douban.com/v2/movie/subject/${item.doubanId}`
    const res = await rp(url)
    return res
}
;(async () => {
    let movies = [
        { doubanId: 30201000,
            title: '幻乐之城',
            rate: 7.2,
            poster:
                'https://img3.doubanio.com/view/photo/l_ratio_poster/public/p2527543485.jpg' },
        { doubanId: 26785790,
            title: '沙海',
            rate: 7,
            poster:
                'https://img3.doubanio.com/view/photo/l_ratio_poster/public/p2527072332.jpg' },
        { doubanId: 26999852,
            title: '延禧攻略',
            rate: 6.8,
            poster:
                'https://img3.doubanio.com/view/photo/l_ratio_poster/public/p2509891341.jpg' }
                  ]
    movies.map(async movie => {
        let movieData = await fetchMovie(movie)
        try {
            movieData = JSON.parse(movieData)
            console.log(movieData.tags)
            console.log(movieData.summary)
        } catch  (err) {
            console.log(err)
        }
    })
})()